package com.example.demospirngdatamybatis.mapper;

import com.example.demospirngdatamybatis.entity.Comment;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    @Select("select * from t_comment where id=#{id}")
    public Comment getCommentById(Integer id);

    @Select("select * from t_comment")
    public List<Comment> getAllComments();

    @Insert("insert into t_comment(content,author,a_id)"+"values (#{content},#{author},#{aId})")
    public int addComment(Comment comment);

    @Update("update t_comment set content=#{content} where id=#{id}")
    public int updateCommentById(Comment comment);

    @Delete("delete from t_comment where id=#{id}")
    public int deleteCommentById(int id);
}
